﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Furion.Schedule;
using Microsoft.Extensions.Logging;

namespace TimeJob.Application
{
    /// <summary>
    /// 作业处理器
    /// </summary>
    public class MyJob : IJob
    {
        private readonly ILogger<MyJob> _logger;
        public MyJob(ILogger<MyJob> logger)
        {
            _logger = logger;
        }

        public Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
        {
            Console.WriteLine("自动交卷:{0}:{1}",context.JobId,context.JobDetail.Description);
            _logger.LogInformation($"{context}");
            Console.WriteLine(DateTime.Now);
            return Task.CompletedTask;
        }
    }
}
